package com.lrd.snapshotorder.config;

import com.lrd.snapshotorder.service.rule.IRule;
import com.lrd.snapshotorder.service.rule.NumericRule;
import com.lrd.snapshotorder.service.rule.RangeRule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

@Configuration
public class RuleConfig {

    @Autowired
    private NumericRule numericRule;
    @Autowired
    private RangeRule rangeRule;

    @Bean(name = "ruleMap")
    public Map<String, IRule> ruleMap() {
        Map<String, IRule> ruleMap = new HashMap<>();
        ruleMap.put("numeric", numericRule);
        ruleMap.put("range", rangeRule);
        return ruleMap;
    }

}
